CC      = gcc
FLAGS   = -g -O0
EXE	= wiki2epub
DOWN = downarticle
OUT = ./output/
#  $make run ART="titulo_articulo" LANG=es

all: epub
	chmod +x get_image.sh
	flex $(EXE).l	
	bison -o $(EXE).tab.c $(EXE).y -yd
	$(CC) $(FLAGS) -o $(EXE) lex.yy.c  $(EXE).tab.c epub.o liblista.o -lfl -ly
	
epub: liblista
	$(CC) $(FLAGS) -c epub.c

liblista:
	$(CC) $(FLAGS) -c liblista.c

run: all download
	./$(EXE) $(ART) < $(OUT)$(ART)

download: 
	$(CC) -o $(DOWN) $(DOWN).c
	./$(DOWN) $(ART) $(LANG)
	
clean:
	rm *.o
	rm -rf epub_FILES
	rm $(EXE) downarticle lex.yy.c wiki2epub.tab.*
